#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    int n;
    std::cout << "输入字符串的个数: ";
    std::cin >> n;
    std::vector<std::string> strings(n);
    
    std::cout << "输入" << n << "个字符串: ";
    for (int i = 0; i < n; ++i) {
        std::cin >> strings[i];
    }
    
    std::sort(strings.begin(), strings.end());
    
    std::cout << "排序后的字符串: ";
    for (const std::string& str : strings) {
        std::cout << str << " ";
    }
    std::cout << std::endl;
    
    return 0;
}